package com.nightlife.model.rbac;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 权限表
 * @author Z.x.Y
 *
 */
@Entity
@Table(name="SYS_PRIVILEGE")
@IdClass(PrivilegePrimaryKey.class)
public class Privilege implements Serializable{
	private static final long serialVersionUID = 1L;
	/**
	 * 用户组
	 */
	@Id
	@ManyToOne
	@JoinColumn(name="groupId")
	private Group group;
	/**
	 * 资源
	 */
	@Id
	@ManyToOne
	@JoinColumn(name="resourceId")
	private Resource resource;
	
	/**
	 * 权限值（单个操作值）
	 */
	private long permission;
	public Group getGroup() {
		return group;
	}
	public void setGroup(Group group) {
		this.group = group;
	}
	public Resource getResource() {
		return resource;
	}
	public void setResource(Resource resource) {
		this.resource = resource;
	}
	public long getPermission() {
		return permission;
	}
	public void setPermission(long permission) {
		this.permission = permission;
	}
}
